package com.msb.apipassenger.controller;

import com.msb.apipassenger.service.PassengerUserService;
import com.msb.commons.response.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author: chshh
 * @version: 1.0
 */
@RestController
public class PassengerUserController {

    @Autowired
    private PassengerUserService userService;

    @GetMapping("/users")
    public ResponseResult getUser(HttpServletRequest request){
        //从http请求中获取accessToken
        String accessToken = request.getHeader("Authorization");
        return userService.getUserByAccessToken(accessToken);
    }
}
